package com.vote.common.enums;

/**
 * 投票状态枚举
 */
public enum  VoteStatusEnum {

    NOT_STARTED(1, "未开始", "color: #6c757d", "暂未开始", "btn btn-secondary disabled", "#"),
    IN_PROGRESS(2, "进行中", "color: #8f93f6", "参与投票", "btn btn-primary", "detail.html"),
    FINISH(3, "已结束", "color: #7fdd85", "投票结果", "btn btn-success", "result.html");

    private Integer code;

    private String status;

    private String color;

    private String button;

    private String disabled;

    private String href;

    VoteStatusEnum (Integer code, String status, String color, String button, String disabled, String href) {
        this.code = code;
        this.status = status;
        this.color = color;
        this.button = button;
        this.disabled = disabled;
        this.href = href;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getButton() {
        return button;
    }

    public void setButton(String button) {
        this.button = button;
    }

    public String getDisabled() {
        return disabled;
    }

    public void setDisabled(String disabled) {
        this.disabled = disabled;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public static VoteStatusEnum getInstance(Integer code) {
        for (VoteStatusEnum item : VoteStatusEnum.values()) {
            if (code.equals(item.getCode())) {
                return item;
            }
        }
        return null;
    }
}
